
    /********************************************************/
    /*                                                      */
    /*                                                      */
    /*         Copyright (C), 1993  SEIKO EPSON Corp.       */
    /*         ALL RIGHTS RESERVED                          */
    /*                                                      */
    /*                                                      */
    /*  file name : rand.c                                  */
    /*                                                      */
    /*  Revision history                                    */
    /*      93/12/17    first release       S.Akaiwa        */
    /*      97/2/20	modified	    T.Katahira	    */
    /*			change function declaration	    */
    /*					to the ANSI style   */
    /*                                                      */
    /********************************************************/

#ifdef      UNIX
#include    "stdlib.h"
#else
#include    <stdlib.h>
#include	<_mj_os.h>
#endif

unsigned int seed;

int
rand( void )

    /********************************************************/
    /*                                                      */
    /*  The rand function generates pseudo random integer   */
    /*  in the range 0 to RAND_MAX.                         */
    /*                                                      */
    /*      RETURN  The pseudo random integer               */
    /*                                                      */  
    /********************************************************/

{
	 seed += TimGetSeconds();
     seed = seed * 1103515245 + 12345; /* update seed value */

             /* generates and returns pseudo random integer */  
     return (unsigned int)(seed / 65535 & RAND_MAX);

}

